/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseEntity;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author 李忠臻
* @date 2024-02-24
**/
@Entity
@Data
@Table(name="godown_entry_detail")
public class GodownEntryDetail extends BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private Long id;

    @Column(name = "`godown_entry_id`")
    @ApiModelProperty(value = "外键")
    private Long godownEntryId;

    @Column(name = "`purchase_data_id`")
    @ApiModelProperty(value = "入库数据ID")
    private Long purchaseDataId;

    @Column(name = "`godown_entry_no`")
    @ApiModelProperty(value = "出货单号")
    private String godownEntryNo;

    @Column(name = "`index`")
    @ApiModelProperty(value = "项次")
    private Integer index;

    @Column(name = "`godown_entry_date`")
    @ApiModelProperty(value = "出货日期")
    private Timestamp godownEntryDate;

    @Column(name = "`model`")
    @ApiModelProperty(value = "产品编号")
    private String model;

    @Column(name = "`quantity`")
    @ApiModelProperty(value = "出货量")
    private Integer quantity;

    @Column(name = "`untax_amount`")
    @ApiModelProperty(value = "未税金额")
    private BigDecimal untaxAmount;

    @Column(name = "`tax_amount`")
    @ApiModelProperty(value = "含税金额")
    private BigDecimal taxAmount;

    @Column(name = "`product_name`")
    @ApiModelProperty(value = "品名规格")
    private String productName;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(name = "`currency`")
    @ApiModelProperty(value = "币别")
    private String currency;

    @Column(name = "`unit_price`")
    @ApiModelProperty(value = "单价")
    private BigDecimal unitPrice;

    @Column(name = "`customer`")
    @ApiModelProperty(value = "账款客户")
    private String customer;

    @Column(name = "`short_customer_name`")
    @ApiModelProperty(value = "客户简称")
    private String shortCustomerName;

    @Column(name = "`order_index`")
    @ApiModelProperty(value = "订单项次")
    private Integer orderIndex;

    @Column(name = "`customer_order_no`")
    @ApiModelProperty(value = "客户订单号")
    private String customerOrderNo;

    /** 供货商名称 */
    @Column(name = "`supplier_name`")
    @ApiModelProperty(value = "供货商名称")
    private String supplierName;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "`init_by`")
    @ApiModelProperty(value = "请购人")
    private String initBy;

    public void copy(GodownEntryDetail source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
